package cn.ikun.gkc;

import cn.ikun.gkc.User;
import org.apache.commons.lang3.RandomStringUtils;

import java.lang.reflect.Method;

public class GKCAPP {
    public static void main(String[] args) throws Exception {
        //随机生成指定位数的数字
        // String s= RandomStringUtils.randomNumeric(6);
        // System.out.println(s);

        //创建User实例
        User u = new User();//左边User是类名，右边是构造器名字
        u.setName("gkc");
        System.out.println(u.getName());

        //创建age实例

        u.setAge(20);
        System.out.println(u.getAge());

        Class<?> UU = Class.forName("cn.ikun.gkc.User");
        Object o = UU.newInstance();
        Method setName = UU.getMethod("setName", String.class);
        setName.invoke(o,"gggod");

        Method getName = UU.getMethod("getName");
        Object result = getName.invoke(o);
        System.out.println(result);

    }

}